package com.bank.dao.impl;

import com.bank.dao.DBUtil;
import com.bank.dao.Interface.UserDao;
import com.bank.model.User;

public class UserDaoImpl extends DBUtil implements UserDao {
    @Override
    public void addUser(User user) {
        String sql="INSERT INTO tb_user(username,card_id,identy_card,password) VALUES(?,?,?,?);";
        super.executeUpdate(sql, user.getUsername(),user.getCard_id(),user.getIdenty_card(),user.getPassword());
    }

    @Override
    public User login(String username, String password) {
        String sql="SELECT * FROM tb_user WHERE username=? and password=?;";
        User user = super.executeQueryOne(sql, User.class, username, password);
        return user;
    }

}
